<template>
  <n-popconfirm v-if="isTauri()" @positive-click="vitsStart" negative-text="取消" positive-text="确认">
    <template #trigger>
      <c-button class="headerBtn" quaternary :type="isStart ? 'primary' : undefined" :loading="loading"
        iconName="RttSharp"></c-button>
    </template>
    {{ isStart ? '终止GPT-SoVits?' : '启动GPT-SoVits?' }}
  </n-popconfirm>
</template>

<script setup lang='ts'>
const { isTauri } = Tauri
const { start, loading, isStart, stop } = useGPTSoVits()
const vitsStart = () => {
  if (isStart.value) {
    stop()
  } else {
    start()
  }
}
</script>
